class debug =
    object(this)

    method read_process program (item : GSourceView2.source_view) =
    let _readMe, _outMe = Unix.pipe () in
    ignore(Unix.create_process program [| program |] (* program [| program; arg1; arg2 |] *)
    Unix.stdin _outMe _outMe);
    Unix.close _outMe;
    let in_channel = Unix.in_channel_of_descr _readMe in
    let lines = ref [] in
    begin
        try
        while true do
            lines := input_line in_channel :: !lines
        done
        with End_of_file -> ()
    end;
    Unix.close _readMe;
    (List.rev !lines)

    method read_process_args program program_args (item : GSourceView2.source_view) =
    let _readMe, _outMe = Unix.pipe () in
    ignore(Unix.create_process program program_args (* program [| program; arg1; arg2 |] *)
    Unix.stdin _outMe _outMe);
    Unix.close _outMe;
    let in_channel = Unix.in_channel_of_descr _readMe in
    let lines = ref [] in
    begin
        try
        while true do
          lines := input_line in_channel :: !lines;
          item#buffer#set_text ((item#buffer#get_text ())^(List.hd !lines)^"\n")
        done
        with End_of_file -> ()
    end;
    Unix.close _readMe;
    (List.rev !lines)
    
    method reload program =
        let () = Unix.execv "/bin/sh" [| "/bin/sh"; "-c"; program |] in ()

    
end
